package com.boc.ewr.util;

import com.boc.ewr.util.file.enumeration.BalanceStatusEnum;
import lombok.extern.slf4j.Slf4j;

import java.util.Arrays;
import java.util.Optional;

/**
 * @author : Wzz
 * @create : 2023-05- 30- 9:51
 * @desc : 系统内角色枚举
 */
@Slf4j
public enum SysRoleEnum {

    ADMIN_CA_HANDLER("admin_ca_handler", "省行对账操作员"),
    ADMIN_CA_CHECK("admin_ca_check", "省行对账复核"),
    BRANCH_BUS_HANDLER("branch_bus_handler", "业务部操作员"),
    BRANCH_BUS_ADM("branch_bus_adm", "业务部对账管理员"),
    BRANCH_BUS_CA_PIC("branch_bus_ca_pic", "业务部对账负责人"),
    ORG_CA_HANDLER("org_ca_handler", "网点对账员");

    private String code;
    private String name;

    SysRoleEnum(String code, String name) {

        this.code = code;
        this.name = name;
    }

    /**
     * 根据value获取枚举对象
     *
     * @param name
     * @return
     */
    public static SysRoleEnum getCodeByName(String name) {
        Optional<SysRoleEnum> first = Arrays.stream(SysRoleEnum.values()).filter(e -> e.getName().equals(name)).findFirst();
        SysRoleEnum expEnum = first.orElse(null);
        log.info("选择的枚举类型是：" + expEnum.toString());
        return expEnum;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }
}
